<?php

namespace Finley\BlogBundle\Entity;

use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;

/**
 * Setting
 *
 * @ORM\Table(name="setting")   # 数据库表名
 * @ORM\Entity(repositoryClass="Finley\BlogBundle\Repository\SettingRepository") # 对应的 Repository 类
 * @Gedmo\SoftDeleteable(fieldName="deleted_at", timeAware=false)/  # 软删除
 */
class Setting
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="field", type="string", length=255, unique=true)
     */
    private $field;

    /**
     * @var string
     *
     * @ORM\Column(name="data", type="string", length=255)
     */
    private $data;


    /**
     * @var \DateTime $created
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $created_at;

    /**
     * @var \DateTime $updated
     *
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $updated_at;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $deleted_at;

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set field
     *
     * @param string $field
     *
     * @return Setting
     */
    public function setField($field)
    {
        $this->field = $field;

        return $this;
    }

    /**
     * Get field
     *
     * @return string
     */
    public function getField()
    {
        return $this->field;
    }

    /**
     * Set data
     *
     * @param string $data
     *
     * @return Setting
     */
    public function setData($data)
    {
        $this->data = $data;

        return $this;
    }

    /**
     * Get data
     *
     * @return string
     */
    public function getData()
    {
        return $this->data;
    }

//    public function setCreated($created)
//    {
//        $this->created_at = $created;
//        return $this;
//    }
//
//    /**
//     * @return \DateTime
//     */
//    public function getCreated()
//    {
//        return $this->created_at;
//    }
//
//    /**
//     * @return \DateTime
//     */
//    public function getUpdated()
//    {
//        return $this->updated_at;
//    }
//
//    public function setUpdated($updated)
//    {
//        $this->updated_at = $updated;
//        return $this;
//    }
//
//    /**
//     * 自动更新时间类型，不要忘了在 Class 上面加注解 ORM\HasLifecycleCallbacks
//     *
//     * @ORM\PrePersist
//     * @ORM\PreUpdate
//     */
//    public function updatedTimestamps()
//    {
//        $this->setUpdated(new \DateTime('now'));
//
//        if ($this->getCreated() == null) {
//            $this->setCreated(new \DateTime('now'));
//        }
//    }
}

